﻿

using HBase;
using System;
namespace hCommand {
    public static class WMSDalFactray {


        static WMSDalFactray() {
        }

        static Type getType(Type type) {
            String fullName = type.FullName;
            int index = fullName.LastIndexOf(".") + 1;
            String dllName = fullName.Substring(0 ,index) + BaseConfig.prefixal + "." + fullName.Substring(index + 1);
            Type implType = type.Assembly.GetType(dllName);//加载类型
            if( implType == null ) {

                String dllNameSqlserver = fullName.Substring(0 ,index) + GKDBType.sqlserver + "." + fullName.Substring(index + 1);
                implType = type.Assembly.GetType(dllNameSqlserver);//加载类型


            }
            return implType;

        }
        public static T getDal<T>() {
            Type type = typeof(T);
            Type implType = getType(type);//加载类型
            if( implType == null ) {
                return default(T);

            }
            Type[] types = implType.GetInterfaces();
            object o = Activator.CreateInstance(implType);
            T t = ( T ) o;
            return t;
        }




    }
}
